package com.xxx.rpc.common.util;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * IP工具
 */
public class IpUtil {
    public static String getLocalIp(){
        String ip = "";
        try {
            InetAddress addr = InetAddress.getLocalHost();
            ip = addr.getHostAddress();
        } catch (UnknownHostException e) {
            return "127.0.0.1";
        }
        return ip;
    }
    
    
    public static void main(String[] args) {
		System.out.println(getLocalIp());
	}
}
